<?php
	/**
	 * 获取goods商品列表
	 */
    class GoodsList extends APIBase {
		
		public $tag = "GoodsList";
		public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			return true;
		}

		public function logic() {
			$keys = $this->cache_redis->lRange("lg:ids", 0, -1);
			$type = $this->param['type'];
			$playerID = $this->uid;
			$goodses = array();
			foreach ($keys as $key) {
				$goods = $this->cache_redis->hMGet("hg:{$key}", array("id", "name","desc","type","buy_money","money", "give_money","propid"));
				$goods["type"] = (int)$goods["type"];
				if($type==1){
					if ($goods["type"] == 1) { //商城商品标识 type=1,房卡
						$gds["id"] = (int)$goods["id"];
						$gds["name"] = (string)$goods["name"];
						$gds["desc"] = (string)$goods["desc"];
						$gds["buy_money"] = (float)$goods["buy_money"];
						$gds["money"] = (int)$goods["money"];
						$gds["give_money"] = (int)$goods["give_money"];
						$goodses[] = $gds;
					}
				}
            }
			
			$this->returnData(array('goodses' => $goodses));
		}
		
    	public function after() {
			$this->deinitCacheRedis();
		}
    }
?>
